<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>test</title>
<style>
#test{ width:100px; height:100px; background:#f00;}
</style>
<script>
window.onload = function(){
    var isOut = true;
    var dom = document.getElementById('test');
    document.onclick = function(e){
		e = e || window.event;
		var target = e.srcElement || e.target;
        if(isOut && target.id.toLowerCase()!='input1'){
            dom.style.display = 'none';
        }
         isOut = true;
    }
}
function show(){
	document.getElementById('test').style.display = 'block';
}
</script>
</head>
<body>
<input type="text" id="input1" onkeyup="show();">
<div id="test" style="display:none">TEST</div>
<input type="text" id="input2" value="text2"/>
</body>
</html>